home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-10-04 | 1.9 KB | 58 lines | [TEXT/MPS ] |
- UNIT RandomNumbers;
-
- { This unit provides the Pascal interface for the random
- number generator implemented in RandomNumbers.a.
-
- This unit was written in MPW Pascal, v3.2.
-
- Jon Bell
- Dept. of Physics & Computer Science
- Presbyterian College
- Clinton SC 29325
- CompuServe: #70441,353
- October 1991 }
-
- INTERFACE
-
- {----------------------------------------------------------}
-
- procedure InitRandomSeed (newSeed : longint);
-
- { Initializes the random number seed to "newSeed". You
- must call this procedure once, at the beginning of your
- program, before you use any of the following functions.
- As far as randomness is concerned, it makes no difference
- what value you use for "newSeed", so long as it isn't
- zero. Using different seeds merely gives you different
- sequences of "random" numbers. Using the same seed each
- time you run the program gives you the same sequence of
- "random" numbers each time, which may be useful for
- debugging. }
-
- {----------------------------------------------------------}
-
- function RandomSeed : longint;
-
- { Returns the current value of the random number seed. }
-
- {----------------------------------------------------------}
-
- function RandomReal : extended;
-
- { Returns a real number, uniformly "randomly" selected
- from the interval (0.0,1.0). Note that this is an
- "open" interval, that is, it does _not_ include 0.0 or
- 1.0. }
-
- {----------------------------------------------------------}
-
- function RandomInteger (max : longint) : longint;
-
- { Returns an integer, uniformly "randomly" selected from
- the interval [1,max]. Note that this is a "closed"
- interval, that is, it _does_ include 1 and max. }
-
- {----------------------------------------------------------}
-
- END.
-